package news.web;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import news.model.CommonResult;
import news.service.ChartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Api(tags = "ECharts管理")
@RestController
@RequestMapping("/chartApi/chartCtl/")
public class ChartController {

    @Autowired
    private ChartService chartService;


    @ApiOperation(value = "柱状图查询")
    @GetMapping("/barCharts")
    public CommonResult barCharts(){
        Map<String,Object> map= chartService.barCharts();
        return new CommonResult(200,map,"查询成功");
    }

    @ApiOperation(value = "饼状图查询")
    @GetMapping("/pieCharts")
    public CommonResult pieCharts(){
        List<Map<String,Integer>> res = chartService.pieCharts();
        return new CommonResult(200,res,"查询成功");
    }
}
